package com.rightsidetech.system.dtos.request;

import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.*;
import java.io.Serializable;

/**
 * @author huanglt
 * @version 2.0
 * @Title:
 * @Package
 * @Description: 新增菜单资源
 * @date 2021/3/29
 */
@Data
public class SysResourceAddReq implements Serializable {
    @ApiModelProperty(value = "名d称", required = true)
    @NotBlank(message = "名称不能为空")
    @Length(max = 20, message = "名称长度不合法")
    @Pattern(regexp = "[\\u4e00-\\u9fa5]+", message = "名称为中文")
    private String name;
    @ApiModelProperty(value = "是否显示：0-显示，1不显示", required = true)
    @NotNull(message = "后台显示不能为空")
    @Min(value = 0, message = "非法参数")
    @Max(value = 1, message = "非法参数")
    private Integer isBlank;
    @ApiModelProperty(value = "是否公共资源，0-不是，1-是", required = true)
    @NotNull(message = "公共类型不能为空")
    @Min(value = 0, message = "公共类型不正确")
    @Max(value = 1, message = "公共类型不正确")
    private Integer isPublic;
    @ApiModelProperty(value = "父类id", required = true)
    @NotNull(message = "父类id不能为空")
    @Min(value = 0, message = "父级id不正确")
    private Long parentId;
    @ApiModelProperty(value = "排序", required = true)
    @NotNull(message = "排序号不能为空")
    private Integer resourceOrder;
    @ApiModelProperty(value = "所属层级:1.一级分类;2.二级分类;3.三级分类")
    @Min(value = 1, message = "所属层级不正确")
    @Max(value = 3, message = "所属层级不正确")
    private Integer rootId;
    @ApiModelProperty("url")
    @Pattern(regexp = "^$|^/[a-zA-Z0-9—_/]+$", message = "url为正斜杠开头字母下划线正斜杠数字为内容字母结尾")
    @Length(max = 500,message = "url过长")
    private String url;
    @ApiModelProperty("图标")
    @Length(max = 500,message = "图标过长")
    private String icon;
    @ApiModelProperty("路径")
    @Length(max = 500,message = "路径过长")
    private String path;
}
